let RobinFilter = {
    emailValidate(value) {
        let pattern = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
        if (value == "" || value == null || value == undefined) {
            return "请填写正确格式的邮箱地址";
        } else {
            if (pattern.test(value)) {
                return "";
            } else {
                return "请填写正确格式的邮箱地址";
            }
        }
    },

    passWordValidate(value) {
        let pattern1 = /^\d{0,9}$/;
        let pattern2 = /^\d{21,50}$/;
        let pattern3 = /^[a-zA-Z\d]{10,20}$/;
        let pattern4 = /^([a-zA-Z]{1,}[\d]{1,})|([\d]{1,}[a-zA-Z]{1,})$/;
        if (value == "" || value == null || value == undefined) {
            return "密码过于简单,请输入10-20位密码,字母+数字组合";
        } else {
            if (pattern1.test(value)) {
                return "长度小于10个字符";
            } else if (pattern2.test(value)) {
                return "长度大于20个字符";
            } else if (pattern3.test(value)) {
                if (pattern4.test(value)) {
                    return "";
                }
                return "密码过于简单,请输入10-20位密码,字母+数字组合";
            } else {
                return "密码过于简单,请输入10-20位密码,字母+数字组合";
            }
        }
    },

    phoneValidate(phone) {
        let pattern = /^1[3456789]\d{9}$/;
        if (!pattern.test(phone)) {
            return "请填写正确格式手机号码";
        }
        return "";
    },

    verifyCodeValidate(code) {
        let pattern = /^\d{6}$/;
        if (!pattern.test(code)) {
            return "请填写6位手机数字验证码";
        }
        return "";
    },

    signaturePwdValidate(value) {
        let pattern1 = /^[0-9]{0,5}$/;
        let pattern2 = /^[0-9]{6}$/;
        if (value == "" || value == null || value == undefined) {
            return "密码不能为空，请输入6位纯数字";
        } else {
            if (pattern1.test(value)) {
                return "密码必须为6位数字";
            } else if (pattern2.test(value)) {
                return "";
            } else {
                return "密码必须为6位数字";
            }
        }
    },

    numberValidate(value){
        let pattern = /^[0-9]*$/;
        if (!pattern.test(value)) {
            return "输入框的内容只能是数字";
        }
        return "";
    },

    priceValidate(value){
        let pattern = /^[0-9\.]*$/;
        if (!pattern.test(value)) {
            return "输入框的内容只能是数字或小数点";
        }
        return "";
    }
};

export default RobinFilter;
